package com.zhuangjie.shop.feign;

import com.zhaungjie.base.conduit.TypeR;
import com.zhuangjie.base.constant.ModuleSecurityNames;
import com.zhuangjie.order.pojo.DishSalesCount;
import com.zhuangjie.order.vo.ShopProfitForShopOrderAccountingVO;
import com.zhuangjie.security.annotations.PublicAPI;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

@Component
@FeignClient(name= "spark-order",path = "/order")
public interface OrderFeignService {
    @ApiOperation("是否新客")
    @PublicAPI(modules = {ModuleSecurityNames.USER})
    @GetMapping("/order/is-new-customer/{shopId}")
    TypeR<Boolean> isNewCustomer(@PathVariable("shopId") Long shopId);

    @GetMapping("/order-amount/query-shop-order-profit-for-accounting/{orderId}")
    @ApiOperation("获取订单商家利润-为了商家入账（会判断订单是否完成）")
    TypeR<ShopProfitForShopOrderAccountingVO> queryShopOrderProfitForAccounting(@PathVariable("orderId") Long orderId);


    @ApiOperation("查询指定shopIds近30天月售数量")
    @GetMapping("/order/month-sales-count")
    TypeR<Map<Long,Long>> batchGetShopMonthSalesCount( @RequestParam("shopIds") String shopIds,@RequestParam("recentDays") Integer recentDays);

    @ApiOperation("获取店铺的所有菜品近n天的销量")
    @GetMapping("/order-detail/shop-dish-sales-count")
    TypeR<List<DishSalesCount>> shopDishSalesCount(@RequestParam("shopId") Long shopId, @RequestParam("nDaysAgo") Integer nDaysAgo);
}